class PaisesController < ApplicationController
  # GET /paises
  # GET /paises.xml
  def index
    @paises = Pais.find(:all)

    respond_to do |format|
      format.html # index.rhtml
      format.xml  { render :xml => @paises.to_xml }
    end
  end

  # GET /paises/1
  # GET /paises/1.xml
  def show
    @pais = Pais.find(params[:id])

    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @pais.to_xml }
    end
  end

  # GET /paises/new
  def new
    @pais = Pais.new
  end

  # GET /paises/1;edit
  def edit
    @pais = Pais.find(params[:id])
  end

  # POST /paises
  # POST /paises.xml
  def create
    @pais = Pais.new(params[:pais])

    respond_to do |format|
      if @pais.save
        flash[:notice] = 'Pais was successfully created.'
        format.html { redirect_to pais_url(@pais) }
        format.xml  { head :created, :location => pais_url(@pais) }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @pais.errors.to_xml }
      end
    end
  end

  # PUT /paises/1
  # PUT /paises/1.xml
  def update
    @pais = Pais.find(params[:id])

    respond_to do |format|
      if @pais.update_attributes(params[:pais])
        flash[:notice] = 'Pais was successfully updated.'
        format.html { redirect_to pais_url(@pais) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @pais.errors.to_xml }
      end
    end
  end

  # DELETE /paises/1
  # DELETE /paises/1.xml
  def destroy
    @pais = Pais.find(params[:id])
    @pais.destroy

    respond_to do |format|
      format.html { redirect_to paises_url }
      format.xml  { head :ok }
    end
  end
end
